package cn.gs.reflect;

// @author gs
import java.util.Collection;

public class ClassTool {

    public static boolean isAssignableFrom(Class father, Class child) {
        if (father != null && child != null) {
            return father.isAssignableFrom(child);
        }
        return false;
    }

    public static boolean isAssignableFrom(Collection<Class> father, Class child) {
        if (father != null && child != null) {
            for (Class c : father) {
                if (c.isAssignableFrom(child)) {
                    return true;
                }
            }
        }
        return false;
    }

    public static boolean isAssignableFrom(Class father, Collection<Class> child) {
        if (father != null && child != null) {
            for (Class c : child) {
                if (father.isAssignableFrom(c)) {
                    return true;
                }
            }
        }
        return false;
    }

    public static boolean isAssignableFrom(Collection<Class> father, Collection<Class> child) {
        if (father != null && child != null) {
            for (Class c : father) {
                if (isAssignableFrom(c, child)) {
                    return true;
                }
            }
        }
        return false;
    }
}
